﻿@inject IStringLocalizer<DialogEditDialog> Localizer

<Button OnClick="@OnEditDialogClick">@Localizer["EditDialogButton"]</Button>

@code {
    [Inject]
    [NotNull]
    private DialogService? DialogService { get; set; }

    private async Task OnEditDialogClick()
    {
        var option = new EditDialogOption<Foo>()
        {
            Title = "Edit popup",
            Model = new Foo(),
            RowType = RowType.Inline,
            ShowLoading = true,
            ItemsPerRow = 2,
            ItemChangedType = ItemChangedType.Update,
            OnEditAsync = async context =>
            {
                await Task.Delay(2000);
                return false;
            }
        };
        await DialogService.ShowEditDialog(option);
    }
}
